﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace AnesSystem.Controls.CommonTables.SC.DCYY
{
    /// <summary>
    /// ShuHouZhengTongCtrl.xaml 的交互逻辑
    /// </summary>
    public partial class ShuHouZhengTongCtrl : CustomCommonTableCtrl
    {
        public ShuHouZhengTongCtrl()
        {
            InitializeComponent();
            sj1.GotFocus += sj1_GotFocus; sj2.GotFocus += sj1_GotFocus;
            sj3.GotFocus += sj1_GotFocus; sj4.GotFocus += sj1_GotFocus;
            sj5.GotFocus += sj1_GotFocus; sj6.GotFocus += sj1_GotFocus;
            sj7.GotFocus += sj1_GotFocus;
        }
        private void ztkssj_GotFocus(object sender, RoutedEventArgs e)
        {
            CusDatePickerWin cusDatePicker = new CusDatePickerWin();
            cusDatePicker.SelectedDateTime = DateTime.Now;
            cusDatePicker.ShowDialog();
            if (cusDatePicker.Result)
            {
                ztkssj.Value = cusDatePicker.SelectedDateTime.ToString(DateFormat.DATE_FORMAT_STR_YMDHM_CN);//2005年11月5日
            }
        }

        private void sj1_GotFocus(object sender, RoutedEventArgs e)
        {
            try
            {
                CustomTextCtrl textCtrl = sender as CustomTextCtrl;
                CusDatePickerWin cusDatePicker = new CusDatePickerWin();
                cusDatePicker.SelectedDateTime = DateTime.Now;
                cusDatePicker.ShowDialog();
                if (cusDatePicker.Result)
                {
                    textCtrl.Value = cusDatePicker.SelectedDateTime.ToString(DateFormat.DATE_FORMAT_STR_YMDHM);//2005-11-5 
                }
            }
            catch
            {

            }

        }
    }
}
